package com.ews.onlineexchange.model.assess;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;

import com.ews.onlineexchange.model.CalcMethod;
import com.ews.onlineexchange.model.DataEntity;

@Entity
public class Dict extends DataEntity {

	/**
	 * 
	 */
	private static final long	serialVersionUID	= 1L;

	private PeriodType			periodType;
	private AssessClass			assessClass;			//评价大类
	private String				title;					//标题
	private CalcMethod			calcMethod;				//计算类型
	private BigDecimal			minScore;				//最小值
	private BigDecimal			maxScore;

	@Enumerated
	public PeriodType getPeriodType() {
		return periodType;
	}

	public void setPeriodType( PeriodType periodType ) {
		this.periodType = periodType;
	}

	@ManyToOne 
	@NotNull
	public AssessClass getAssessClass() {
		return assessClass;
	}

	public void setAssessClass( AssessClass assessClass ) {
		this.assessClass = assessClass;
	}

	@NotEmpty
	@Column( unique = true )
	public String getTitle() {
		return title;
	}

	public void setTitle( String title ) {
		this.title = title;
	}

	@Enumerated( EnumType.ORDINAL )
	public CalcMethod getCalcMethod() {
		return calcMethod;
	}

	public void setCalcMethod( CalcMethod calcMethod ) {
		this.calcMethod = calcMethod;
	}

	@NotNull
	@Min(1L)
	public BigDecimal getMinScore() {
		return minScore;
	}

	public void setMinScore( BigDecimal minScore ) {
		this.minScore = minScore;
	}

	@NotNull
	@Min(1L)
	public BigDecimal getMaxScore() {
		return maxScore;
	}

	public void setMaxScore( BigDecimal maxScore ) {
		this.maxScore = maxScore;
	}

}
